package com.zty.user.designPattern.responsibilityChainPattern;

import org.apache.commons.collections4.CollectionUtils;

/**
 * 上下文，上一个链检查好的东西要传给此次链
 */
public class RuleCheckContext {

    /**
     * 规则检查上个链传来的结果
     */
    private RuleCheckResult ruleCheckResult = new RuleCheckResult();

    public RuleCheckResult getRuleCheckResult() {
        return ruleCheckResult;
    }

    /**
     * 判断当前结果是否有错误信息
     * @return
     */
    public boolean hasError() {
        return CollectionUtils.isNotEmpty(ruleCheckResult.getFailedMsgList());
    }

    public void setRuleCheckResult(RuleCheckResult ruleCheckResult) {
        this.ruleCheckResult = ruleCheckResult;
    }
}